<html>
<head><meta charset="utf-8"><title>patching-previous-versions · wg-secure-code · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/index.html">wg-secure-code</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html">patching-previous-versions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="160968266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160968266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160968266">(Mar 16 2019 at 21:21)</a>:</h4>
<p>Hello everyone,</p>
<p>I would not be surprised if people already talked about this but I wanted to raise the the following problem.</p>
<p>Currently the policy of <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> is: "Take care when publishing a crate, because a publish is permanent. The version can never be overwritten, and the code cannot be deleted." according to the <a href="https://doc.rust-lang.org/nightly/cargo/reference/publishing.html" target="_blank" title="https://doc.rust-lang.org/nightly/cargo/reference/publishing.html">publishing reference</a>.</p>
<p>The problem however is this:</p>
<p>Let's say we have our library MyCoolLib of version 1.0.0. We have a huge project and make use of MyCoolLib a lot. The people working on MyCoolLib however have not been sitting still and release a version 2.0.0 which contains a complete re-haul of the public interface. After a while when releasing 2.4.3 they suddenly discover a big vulnerability which is contained in the code both used by 1.0.0 and 2.0.0 versions! We can basically say to people using 2.0.0 that they just have to update their packages. However people still using 1.0.0 cannot update their dependency so easily since the public interface is completely different. Since we cannot fix the vulnerability once they are deployed we are kind of stuck with a problem.</p>
<p>So I was wondering: Wouldn't it be a good idea to be able to re-publish earlier versions with fixes as long as the public interface doesn't change?</p>



<a name="160968376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160968376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160968376">(Mar 16 2019 at 21:24)</a>:</h4>
<p>EDIT: I should have thought about this longer..... They can probably just release a 1.x.1 containing the fix and ask them to update to that instead right? That should fix the problem. The only problem then is how people can be made aware of vulnerable versions.</p>
<p>I am not sure how to close a topic, but this one can be closed by a moderator of this stream!</p>



<a name="160968475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160968475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> briansmith <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160968475">(Mar 16 2019 at 21:27)</a>:</h4>
<p><span class="user-mention" data-user-id="213094">@DevQps</span> To some extent, you can make people aware that the old version shouldn't be used by yanking it. In some cases this will mostly-automatically do the upgrade to the 1.0.1 version.</p>



<a name="160968548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160968548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160968548">(Mar 16 2019 at 21:29)</a>:</h4>
<p>Thanks for your response, that sounds interesting. Can you give me a concrete example on which it will automatically do the upgrade to the 1.0.1 version?</p>



<a name="160969192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160969192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> snf <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160969192">(Mar 16 2019 at 21:44)</a>:</h4>
<p>I think he means that if you have version "1.0" in your config, it will automatically fetch "1.0.1" if "1.0.0" has been yanked</p>



<a name="160969431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160969431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160969431">(Mar 16 2019 at 21:50)</a>:</h4>
<p>A great! I didn't know this actually existed! That really solves a lot of problems. I wonder how many people do this instead of including the exact version (including patch number). I guess this should be a best practice right? If people truly all did this, and crate maintainers published bug fixes, then it can only go wrong when a specific version is locked in Cargo.lock, or an application is already deployed somewhere. Can you actually publish crates to <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> using this syntax? Or would it be replaced with the a version including the patch number? After all you cannot be 100 percent sure if someone changes the public interface in a patch version right?</p>



<a name="160970077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160970077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> snf <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160970077">(Mar 16 2019 at 22:08)</a>:</h4>
<p>This syntax?, it's semver. It's a best practice not to break the APIs on patch number updates but there are no guarantees. Although, it should be possible to make a (cargo-)tool for checking them</p>



<a name="160991095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160991095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160991095">(Mar 17 2019 at 09:12)</a>:</h4>
<p>I think integrating this to <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> would be a great step forward as well. If <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> can just check the public API of a previous version and denies uploading a crate if the public API has been changed in a patch version bump, that would be a great step forward into using x.y as dependency versions.</p>
<p>Technically it could break builds, if developers would release a minor patch version that breaks certain functionality, but I think that happens less often, then people using some version x.y.z and forgetting to upgrade after a big bug / vulnerability has been patched.</p>



<a name="160998612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/160998612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#160998612">(Mar 17 2019 at 13:21)</a>:</h4>
<p>The tool actually exists: <a href="https://github.com/rust-dev-tools/rust-semverver" target="_blank" title="https://github.com/rust-dev-tools/rust-semverver">https://github.com/rust-dev-tools/rust-semverver</a><br>
But yes, I was very much surprised when I found that uploads violating semver are not rejected by <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a></p>



<a name="161009354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/161009354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#161009354">(Mar 17 2019 at 18:23)</a>:</h4>
<p><span class="user-mention" data-user-id="127617">@Shnatsel</span> Maybe we can create an issue for this? I am not really sure how hard it would be to actually implement this for <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> however. But I think it would be a great addition.</p>



<a name="161116914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/161116914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Carosone <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#161116914">(Mar 19 2019 at 03:16)</a>:</h4>
<p>It does, however, require that there <em>is</em> a 1.0.1 patched version to update to; ie that the crate maintainer does back-port their bugfix.</p>



<a name="161124554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/161124554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DevQps <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#161124554">(Mar 19 2019 at 06:25)</a>:</h4>
<p><span class="user-mention" data-user-id="208943">@Daniel Carosone</span> You mean that <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a> already does this? Or do you mean that in order for this to work people should back-port their bug-fix?</p>



<a name="161129090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/patching-previous-versions/near/161129090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Carosone <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/patching-previous-versions.html#161129090">(Mar 19 2019 at 08:05)</a>:</h4>
<p>yeah, there needs to be a back-ported fix release, in order for users to upgrade to it. Seems obvious, but it might not be a valid assumption. There's no mandatory or consistent maintenance policy for crates.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>